package collection;

import entity.Student;
import junit.framework.TestCase;
import lombok.Data;
import org.junit.Test;

import java.util.*;

/**
 * @author zhangxin
 * @date 2021/4/22
 */
public class MapTest {

    public static void main(String[] args) {

        // treeMapTest();
    }
    @Test
    public void treeMapTest(){
        Map<Student, Student> treeMap = new TreeMap<>();
        treeMap.put(new Student(), new Student());
    }



    @Test
    public void charTest() {
        char a = 'a';
        char A = 'A';

        System.out.println(A - a);
        char b = (char) (a + 26);
        System.out.println(b);
    }


    @Test
    public void mapTest() {
        HashMap<HashObject, Object> hashObjectObjectHashMap = new HashMap<>(22);

        List<HashObject> hashObjectList = new ArrayList<>();
        for (int i = 0; i < 165; i++) {
            HashObject hashObject = new HashObject();
            hashObjectList.add(hashObject);


            hashObjectObjectHashMap.put(hashObject, hashObject);
        }


        hashObjectList.forEach(e->{
            hashObjectObjectHashMap.remove(e);
        });
        for (int j = this.hashCode(); j < 22; j++) {

        }
    }
}


@Data
class HashObject {

    private int no;

    @Override
    public int hashCode() {
        return  1;
    }

    @Override
    public boolean equals(Object obj) {
        return this == obj;
    }
}
